/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package co.com.entidad;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 *
 * @author 841756
 */
@Entity
@Table(name = "tbl_rolusuario")
@NamedQueries({
    @NamedQuery(name = "TblRolusuario.findAll", query = "SELECT t FROM TblRolusuario t"),
    @NamedQuery(name = "TblRolusuario.findByCodRolusario", query = "SELECT t FROM TblRolusuario t WHERE t.codRolusario = :codRolusario")})
public class TblRolusuario implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "cod_rolusario")
    private BigDecimal codRolusario;
    @JoinColumn(name = "cod_rol", referencedColumnName = "cod_rol")
    @ManyToOne(optional = false)
    private Tblroles codRol;
    @JoinColumn(name = "usuario", referencedColumnName = "usuario")
    @ManyToOne(optional = false)
    private TblUsuario usuario;

    public TblRolusuario() {
    }

    public TblRolusuario(BigDecimal codRolusario) {
        this.codRolusario = codRolusario;
    }

    public BigDecimal getCodRolusario() {
        return codRolusario;
    }

    public void setCodRolusario(BigDecimal codRolusario) {
        this.codRolusario = codRolusario;
    }

    public Tblroles getCodRol() {
        return codRol;
    }

    public void setCodRol(Tblroles codRol) {
        this.codRol = codRol;
    }

    public TblUsuario getUsuario() {
        return usuario;
    }

    public void setUsuario(TblUsuario usuario) {
        this.usuario = usuario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codRolusario != null ? codRolusario.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TblRolusuario)) {
            return false;
        }
        TblRolusuario other = (TblRolusuario) object;
        if ((this.codRolusario == null && other.codRolusario != null) || (this.codRolusario != null && !this.codRolusario.equals(other.codRolusario))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + codRolusario + "";
    }
    
}
